package Package1;

public class Test {
    public static void main(String[] args) {
        Animal animal = new Animal() {
            @Override
            public void eat() {
                System.out.println("Animal is eating");
            }
        };
    }
}

abstract class Animal {
    public abstract void eat();
}

interface AnimalInterface {
    void eat1();
}

interface Intertest {
    //交换数组中的两个元素
    public void swap(int i, int j);
    //翻转数组
    public void reverse();
}

class Dog extends Animal implements AnimalInterface, Intertest{
    @Override
    public void eat() {
        System.out.println("Dog is eating");
    }
    @Override
    public void eat1() {
        System.out.println("Dog is eating1");
    }

    @Override
    public void swap(int i, int j) {
        System.out.println("Dog is swapping");
    }
    @Override
    public void reverse() {
        System.out.println("Dog is reversing");
    }
}


class Num implements Intertest{
    int[] nums;
    public Num(int[] nums){
        this.nums=nums;
    }
    public Num(){
        this.nums=new int[]{1,2,3,4,5,6,7,8,9,10};
    }
    public void print(){
        for (int i:nums)
            System.out.print(i+"!");
        System.out.println();
    }
    @Override
    public void swap(int i, int j) {
        int temp=nums[i];
        nums[i]=nums[j];
        nums[j]=temp;
    }
    @Override
    public void reverse() {
        int left=0;
        int right=nums.length-1;
        while(left<right){
            swap(left,right);
            left++;
            right--;
        }
    }
}